.class public Lcom/burstly/lib/component/ComponentQueueElement;
.super Ljava/lang/Object;
.source "ComponentQueueElement.java"


# static fields
.field private static final ADAPTOR_NAME_KEY:Ljava/lang/String; = "adaptorName"

.field private static final CONTEXT_KEY:Ljava/lang/String; = "context"

.field private static final LOG:Lcom/burstly/lib/util/LoggerExt; = null

.field private static final TAG:Ljava/lang/String; = "ComponentQueueElement"

.field private static final VIEW_ID_KEY:Ljava/lang/String; = "viewId"


# instance fields
.field private final mAdaptorName:Ljava/lang/String;

.field private final mBurstlyViewId:Ljava/lang/String;

.field private mCreativeData:Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;

.field private final mFactoryClassName:Ljava/lang/String;

.field private mFactoryId:Ljava/lang/String;

.field private mFullRequest:Lcom/burstly/lib/network/beans/RequestData;

.field private mFullResponse:Lcom/burstly/lib/network/beans/ResponseBean;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 57
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/ComponentQueueElement;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method constructor <init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    .locals 0
    .parameter "burstlyViewId"
    .parameter "adaptorName"
    .parameter "fullFactoryClass"

    .prologue
    .line 106
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 107
    iput-object p1, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mBurstlyViewId:Ljava/lang/String;

    .line 108
    iput-object p2, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mAdaptorName:Ljava/lang/String;

    .line 109
    iput-object p3, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mFactoryClassName:Ljava/lang/String;

    .line 110
    iput-object p2, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mFactoryId:Ljava/lang/String;

    .line 111
    return-void
.end method


# virtual methods
.method protected createAdaptorController(Lcom/burstly/lib/component/ControllerConfig;)Lcom/burstly/lib/component/AdaptorController;
    .locals 1
    .parameter "config"

    .prologue
    .line 180
    new-instance v0, Lcom/burstly/lib/component/AdaptorController;

    invoke-direct {v0, p1}, Lcom/burstly/lib/component/AdaptorController;-><init>(Lcom/burstly/lib/component/ControllerConfig;)V

    return-object v0
.end method

.method protected createControllerConfig(Landroid/content/Context;Lcom/burstly/lib/component/IBurstlyAdaptor;)Lcom/burstly/lib/component/ControllerConfig;
    .locals 2
    .parameter "context"
    .parameter "adaptor"

    .prologue
    .line 191
    new-instance v0, Lcom/burstly/lib/component/ControllerConfig;

    invoke-direct {v0}, Lcom/burstly/lib/component/ControllerConfig;-><init>()V

    .line 192
    .local v0, config:Lcom/burstly/lib/component/ControllerConfig;
    invoke-virtual {v0, p2}, Lcom/burstly/lib/component/ControllerConfig;->setAdaptor(Lcom/burstly/lib/component/IBurstlyAdaptor;)V

    .line 193
    invoke-virtual {v0, p1}, Lcom/burstly/lib/component/ControllerConfig;->setContext(Landroid/content/Context;)V

    .line 194
    iget-object v1, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mCreativeData:Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;

    invoke-virtual {v0, v1}, Lcom/burstly/lib/component/ControllerConfig;->setCreativeData(Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;)V

    .line 195
    iget-object v1, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mFullResponse:Lcom/burstly/lib/network/beans/ResponseBean;

    invoke-virtual {v0, v1}, Lcom/burstly/lib/component/ControllerConfig;->setResponseBean(Lcom/burstly/lib/network/beans/ResponseBean;)V

    .line 196
    iget-object v1, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mFullRequest:Lcom/burstly/lib/network/beans/RequestData;

    invoke-virtual {v0, v1}, Lcom/burstly/lib/component/ControllerConfig;->setRequestData(Lcom/burstly/lib/network/beans/RequestData;)V

    .line 197
    iget-object v1, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mBurstlyViewId:Ljava/lang/String;

    invoke-virtual {v0, v1}, Lcom/burstly/lib/component/ControllerConfig;->setBurstlyViewId(Ljava/lang/String;)V

    .line 198
    return-object v0
.end method

.method protected createFactoryParameters(Ljava/lang/Object;)Ljava/util/Map;
    .locals 3
    .parameter "context"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/Object;",
            ")",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/Object;",
            ">;"
        }
    .end annotation

    .prologue
    .line 166
    new-instance v0, Ljava/util/HashMap;

    const/4 v1, 0x4

    invoke-direct {v0, v1}, Ljava/util/HashMap;-><init>(I)V

    .line 167
    .local v0, factoryParams:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    const-string v1, "context"

    invoke-interface {v0, v1, p1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 168
    const-string v1, "viewId"

    iget-object v2, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mBurstlyViewId:Ljava/lang/String;

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 169
    const-string v1, "adaptorName"

    iget-object v2, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mAdaptorName:Ljava/lang/String;

    invoke-interface {v0, v1, v2}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 170
    return-object v0
.end method

.method getController(Ljava/util/Map;)Lcom/burstly/lib/component/IAdaptorController;
    .locals 6
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "*>;)",
            "Lcom/burstly/lib/component/IAdaptorController;"
        }
    .end annotation

    .prologue
    .line 121
    .local p1, params:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;*>;"
    if-eqz p1, :cond_1

    const-string v5, "context"

    invoke-interface {p1, v5}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v5

    if-eqz v5, :cond_1

    .line 122
    const-string v5, "context"

    invoke-interface {p1, v5}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    .line 123
    .local v2, context:Ljava/lang/Object;
    invoke-virtual {p0, p1, v2}, Lcom/burstly/lib/component/ComponentQueueElement;->tryToCreateAdaptor(Ljava/util/Map;Ljava/lang/Object;)Lcom/burstly/lib/component/IBurstlyAdaptor;

    move-result-object v0

    .line 124
    .local v0, adaptor:Lcom/burstly/lib/component/IBurstlyAdaptor;
    if-eqz v0, :cond_1

    .line 125
    check-cast v2, Landroid/content/Context;

    .end local v2           #context:Ljava/lang/Object;
    invoke-virtual {p0, v2, v0}, Lcom/burstly/lib/component/ComponentQueueElement;->createControllerConfig(Landroid/content/Context;Lcom/burstly/lib/component/IBurstlyAdaptor;)Lcom/burstly/lib/component/ControllerConfig;

    move-result-object v1

    .line 126
    .local v1, config:Lcom/burstly/lib/component/ControllerConfig;
    invoke-virtual {p0, v1}, Lcom/burstly/lib/component/ComponentQueueElement;->createAdaptorController(Lcom/burstly/lib/component/ControllerConfig;)Lcom/burstly/lib/component/AdaptorController;

    move-result-object v3

    .line 127
    .local v3, defautAdaptorController:Lcom/burstly/lib/component/AdaptorController;
    const-string v5, "responseSaver"

    invoke-interface {p1, v5}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v4

    .line 128
    .local v4, responseSaver:Ljava/lang/Object;
    if-eqz v4, :cond_0

    instance-of v5, v4, Lcom/burstly/lib/persistance/ResponseSaver;

    if-eqz v5, :cond_0

    .line 129
    check-cast v4, Lcom/burstly/lib/persistance/ResponseSaver;

    .end local v4           #responseSaver:Ljava/lang/Object;
    invoke-virtual {v3, v4}, Lcom/burstly/lib/component/AdaptorController;->setResponseSaver(Lcom/burstly/lib/persistance/ResponseSaver;)V

    .line 131
    :cond_0
    new-instance v5, Lcom/burstly/lib/component/networkcomponent/NetworkAwareControllerWrapper;

    invoke-direct {v5, v3}, Lcom/burstly/lib/component/networkcomponent/NetworkAwareControllerWrapper;-><init>(Lcom/burstly/lib/component/IAdaptorController;)V

    .line 134
    .end local v0           #adaptor:Lcom/burstly/lib/component/IBurstlyAdaptor;
    .end local v1           #config:Lcom/burstly/lib/component/ControllerConfig;
    .end local v3           #defautAdaptorController:Lcom/burstly/lib/component/AdaptorController;
    :goto_0
    return-object v5

    :cond_1
    const/4 v5, 0x0

    goto :goto_0
.end method

.method getCreativeData()Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;
    .locals 1

    .prologue
    .line 216
    iget-object v0, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mCreativeData:Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;

    return-object v0
.end method

.method getFactoryId()Ljava/lang/String;
    .locals 1

    .prologue
    .line 252
    iget-object v0, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mFactoryId:Ljava/lang/String;

    return-object v0
.end method

.method getFullRequest()Lcom/burstly/lib/network/beans/RequestData;
    .locals 1

    .prologue
    .line 239
    iget-object v0, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mFullRequest:Lcom/burstly/lib/network/beans/RequestData;

    return-object v0
.end method

.method setCreativeData(Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;)V
    .locals 0
    .parameter "responseData"

    .prologue
    .line 225
    iput-object p1, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mCreativeData:Lcom/burstly/lib/network/beans/ResponseBean$ResponseData;

    .line 226
    return-void
.end method

.method setFactoryId(Ljava/lang/String;)V
    .locals 0
    .parameter "factoryId"

    .prologue
    .line 256
    iput-object p1, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mFactoryId:Ljava/lang/String;

    .line 257
    return-void
.end method

.method setFullRequest(Lcom/burstly/lib/network/beans/RequestData;)V
    .locals 0
    .parameter "fullRequest"

    .prologue
    .line 248
    iput-object p1, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mFullRequest:Lcom/burstly/lib/network/beans/RequestData;

    .line 249
    return-void
.end method

.method setFullResponse(Lcom/burstly/lib/network/beans/ResponseBean;)V
    .locals 0
    .parameter "fullResponse"

    .prologue
    .line 207
    iput-object p1, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mFullResponse:Lcom/burstly/lib/network/beans/ResponseBean;

    .line 208
    return-void
.end method

.method public toString()Ljava/lang/String;
    .locals 2

    .prologue
    .line 230
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "QueueElement for "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    iget-object v1, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mAdaptorName:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method tryToCreateAdaptor(Ljava/util/Map;Ljava/lang/Object;)Lcom/burstly/lib/component/IBurstlyAdaptor;
    .locals 8
    .parameter
    .parameter "context"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "*>;",
            "Ljava/lang/Object;",
            ")",
            "Lcom/burstly/lib/component/IBurstlyAdaptor;"
        }
    .end annotation

    .prologue
    .local p1, params:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;*>;"
    const/4 v3, 0x0

    .line 145
    const/4 v0, 0x0

    .line 146
    .local v0, adaptor:Lcom/burstly/lib/component/IBurstlyAdaptor;
    iget-object v4, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mFactoryClassName:Ljava/lang/String;

    iget-object v5, p0, Lcom/burstly/lib/component/ComponentQueueElement;->mFactoryId:Ljava/lang/String;

    invoke-static {v4, v5, p1}, Lcom/burstly/lib/component/AdaptorFactoryCache;->getFactory(Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;)Lcom/burstly/lib/feature/networks/IAdaptorFactory;

    move-result-object v1

    .line 147
    .local v1, factory:Lcom/burstly/lib/feature/networks/IAdaptorFactory;
    if-eqz v1, :cond_0

    .line 148
    invoke-virtual {p0, p2}, Lcom/burstly/lib/component/ComponentQueueElement;->createFactoryParameters(Ljava/lang/Object;)Ljava/util/Map;

    move-result-object v2

    .line 149
    .local v2, factoryParams:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    sget-object v4, Lcom/burstly/lib/component/ComponentQueueElement;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v5, "ComponentQueueElement"

    const-string v6, "Creating adaptor..."

    const/4 v7, 0x0

    new-array v7, v7, [Ljava/lang/Object;

    invoke-virtual {v4, v5, v6, v7}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 150
    invoke-interface {v1, v2}, Lcom/burstly/lib/feature/networks/IAdaptorFactory;->createAdaptor(Ljava/util/Map;)Lcom/burstly/lib/component/IBurstlyAdaptor;

    move-result-object v0

    .line 151
    if-nez v0, :cond_1

    .line 156
    .end local v2           #factoryParams:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    :cond_0
    :goto_0
    return-object v3

    .line 154
    .restart local v2       #factoryParams:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
    :cond_1
    new-instance v3, Lcom/burstly/lib/component/AdaptorWrapper;

    invoke-direct {v3, v0, v1}, Lcom/burstly/lib/component/AdaptorWrapper;-><init>(Lcom/burstly/lib/component/IBurstlyAdaptor;Lcom/burstly/lib/feature/networks/IAdaptorFactory;)V

    goto :goto_0
.end method
